package com.sen.pro.switches.front.action;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.sen.common.struts.BaseAction;
import com.sen.pro.switches.core.serivce.SiteLinksService;
import com.sen.pro.switches.core.util.ActionUtils;

/**
 * 首页
 * 
 * @author tian qingsen
 */
@Scope("prototype")
@Controller("indexAction")
@Namespace("/")
public class IndexAction extends BaseAction {

	private static final long serialVersionUID = 6846954095209323572L;
	private static Logger LOG = Logger.getLogger(IndexAction.class);

	@Resource(name = "siteLinksService")
	private SiteLinksService siteLinksService;

	@Action(value = "index", results = { @Result(name = SUCCESS, location = "/WEB-INF/view/index.jsp") })
	public String index() {
		LOG.info("回首页");
		ActionUtils.initSiteImg(request);
		
		request.setAttribute("linkList", siteLinksService.queryAllSiteLinks());
		
		return SUCCESS;
	}
}
